﻿Imports System
Imports System.Workflow.ComponentModel.Compiler

Namespace System.Workflow.ComponentModel
    Friend NotInheritable Class SuspendValidator
        Inherits ActivityValidator
        ' Methods
        Public Overrides Function Validate(ByVal manager As ValidationManager, ByVal obj As Object) As ValidationErrorCollection
            Dim errors As ValidationErrorCollection = MyBase.Validate(manager, obj)
            Dim activity As SuspendActivity = [TryCast](obj,SuspendActivity)
            If (activity Is Nothing) Then
                Throw New ArgumentException(SR.GetString("Error_UnexpectedArgumentType", New Object() { GetType(SuspendActivity).FullName }), "obj")
            End If
            Dim activity2 As CompositeActivity = activity.Parent
            Do While (Not activity2 Is Nothing)
                If activity2.SupportsTransaction Then
                    errors.Add(New ValidationError(SR.GetString("Error_SuspendInAtomicScope"), &H525))
                    Return errors
                End If
                activity2 = activity2.Parent
            Loop
            Return errors
        End Function

    End Class
End Namespace

